#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

void solve() {
    int a = INT_MAX, b = INT_MAX, c = INT_MIN, d = INT_MIN;
    for(int i = 0; i < 4; i++) {
        int x, y;
        cin >> x  >> y;
        a = min(a, x);
        b = min(b, y);
        c = max(c, x);
        d = max(d, y);
    }
    cout << (d  - b) * (c - a) << endl;
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}